<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<span>名字:</span><input id="nam" type="" name="" id="" value="" />
		<button id="an1">按钮</button><br />
	    <span>出题范围:</span>
	    <input id="qian" type="" name="" id="" value="" />
	    <input id="hou" type="" name="" id="" value="" /><br />
	    <span>抽选题数</span>
	    <input id="cs" type="" name="" id="" value="" />
	    <button id="an2">随机</button>
	    <div id="xs"></div>
	</body>
	<script type="text/javascript">
		var arr = ["丁诺涵","杜涵雪","顾珈萌","郭润茜","李欣","刘秋宏","柳天赐","宁可盈","石慧雨","苏玮一","王若怡","王潇苒","王艳华","于凡芮","翟学蔓","翟莹萍","张慧琳","张凯月","张怡菲","陈奥",
		"董正科","花京辰","李辰泽","李冲","李朋哲","李志颖","林启隆","刘晨光","刘祎明","吕振汉","陶建鹏","陶世林","王一博","王志勇","吴玉祥","詹鹏","张杰","夏明丽"];
		
		console.log(arr);
		var an1=document.getElementById("an1");
		var nam = document.getElementById("nam");
		an1.onclick=function(){
				var x1 = Math.floor(Math.random()*arr.length);
				nam.value=arr[x1];
		}
		
		var an2 =document.getElementById("an2");
		an2.onclick=function(){
			var arr2= [];
			var qian = document.getElementById("qian").value;
		    var hou = document.getElementById("hou").value;
			qian1=parseInt(qian);
			hou1=parseInt(hou);
//			console.log(qian1+hou1);
			for(var i=qian1;i<=hou1;i++){
				arr2.push(i);
			}
			console.log(arr2);
			var arr3 = [];
			var cs = document.getElementById("cs").value;
			cs1 = parseInt(cs);
            for(var i =0;i<cs1;){
            	var x2=Math.floor(Math.random()*arr2.length);
            	var pd = true;
            	for(var p=0;p<arr3.length;p++){
            		if(arr2[x2]==arr3[p]){
            			pd =false;
            		}
            		
            	}
            	if(pd){
            			arr3.push(arr2[x2]);i++;
            		}
            }
            console.log(arr3);
            var xs = document.getElementById("xs");
            xs.innerHTML=arr3;
		}
	</script>
</html>
